using System.Collections.Generic;
using PropertyExpression.Common;

namespace PropertyExpression.ReactiveRelation
{
    public static partial class Value
    {
        public static IValue<T> Const<T>(this T arg)
        {
            return new ConstValue<T>(arg);
        }

        private class ConstValue<T> : IValue<T>
        {
            private readonly T arg;

            public ConstValue(T arg)
            {
                this.arg = arg;
            }

            public IOptionalValue<T> GetValue(IPropertySettor propertySettor, 
                IOneToManyCollectionNewItemProcessor oneToManyCollectionNewItemProcessor)
            {
                return arg.AsOptionalResult();
            }

            public IEnumerable<ICell> GetCells()
            {
                return new ICell[] { };
            }
        }
    }
}
